#@embedLayout()


#define content()

<form id="formId" method="post">
    <input type="hidden" id="resourceId" name="resource.resource_id" value="#(resource.resourceId??)">
    <table class="table table-bordered">
        <tr>
            <td style="padding-top:15px;">父节点:</td>
            <td>
                <input type="text" id="pid" name="resource.pid">
            </td>
        </tr>
        <tr>
            <td style="padding-top:15px;">资源名称:</td>
            <td>
                <input type="text" id="resourceName" name="resource.resource_name" class="easyui-textbox" data-options="required:true" value="#(resource.resource_name??)" >
            </td>
        </tr>
        <tr>
            <td style="padding-top:15px;">URL:</td>
            <td>
                <input type="text" id="url" name="resource.url" class="easyui-textbox" data-options="required:true" value="#(resource.url??)" >
            </td>
        </tr>
        <tr>
            <td style="padding-top:15px;">类型:</td>
            <td>
                <select id="resource_type" class="easyui-combobox" name="resource.resource_type" style="width: 150px;">
                    <option value="1" #if(resource.resource_type?? == 1) selected #end>系统菜单</option>
                    <option value="2" #if(resource.resource_type?? == 2) selected  #end>系统功能</option>
                </select>
            </td>
        </tr>
        <tr>
            <td style="padding-top:15px;">图标:</td>
            <td>
                <input type="text" id="icon" name="resource.icon" class="easyui-textbox" value="#(resource.icon??)" data-options="prompt:'请点击按钮选择图标...',
                icons: [{
                    iconCls:'icon-calendar_link',
                    handler: selectIcon
			    }]">
            </td>
        </tr>
        <tr>
            <td style="padding-top:15px;">是否启用:</td>
            <td>
                <select name="resource.is_enable" id="isEnable" class="easyui-combobox" data-options="editable:false" style="width: 150px;">
                    <option value="1" #if(resource.isEnable?? == "1") selected #end>启用</option>
                    <option value="0" #if(resource.isEnable?? == "0") selected #end>不启用</option>
                </select>
            </td>
        </tr>
        <tr>
            <td style="padding-top:15px;">排序:</td>
            <td>
                <input type="text" class="easyui-numberbox" id="orderNumber" name="resource.order_number" data-options="required:true" value="#(resource.order_number??)">
            </td>
        </tr>
        <tr>
            <td style="padding-top:15px;">#(_res.get('user.form.des')):</td>
            <td style="padding-top:12px;">
                <input type="text" class="easyui-textbox" id="des" name="resource.des" data-options="validType:{length:[0,500]},multiline:true" value="#(resource.des??)" style="width:98%;height:150px;">
            </td>
        </tr>
    </table>
</form>

#end


#define css()
input, select, textarea {
    width: 99%;
}

#end


#define js()

<script type="text/javascript">

    $(function(){
        var pid = '#(resource.pid??)';

        $('#pid').combotree({
            url: contextRootPath + '/resource/getTreeList'
        }).combotree('setValue', pid);
    });




    function datagrid_save(opr_type) {
        var url = '';
        if (opr_type == 'add') {
            url = contextRootPath + '/resource/save';
        } else {
            url = contextRootPath + '/resource/update';
        }

        $('#formId').form('submit', {
            url: url,
            onSubmit: function () {
                var flag = $(this).form('enableValidation').form('validate');
                if (flag) {
                    showProcess(true, '温馨提示', '正在提交数据...');
                }
                return flag;
            },
            success: function (data) {
                showProcess(false);
                var params = {};
                params.element = _datagrid;
                params.data = data;
                resultCallback(params);
                $('#' + _datagrid).treegrid("reload");
            },
            onLoadError: function () {
                showProcess(false);
                $.messager.alert('温馨提示', '由于网络或服务器太忙，提交失败，请重试！');
            }
        });
    }


    function selectIcon(e) {
        var params = {};
        params.title = "选择图标";
        params.dlgId = 'resource_iconselect_crud_dlg';
        params.width = 600;
        params.height = 600;
        params.top = '10px';
        params.modal = true;
        params.iconCls = 'icon-calendar_link';
        params.url = contextRootPath + '/resource/iconSelect';

        crud_dlg(params);
    }

</script>

#end


